package com.hualan.mapper;

import com.hualan.pojo.Consultants;
import com.hualan.pojo.Zixunyuyue;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MyzixunMapper {

    @Select("select * from zixunyuyue where del=0 and uid=#{uid}")
    @Results({
            @Result(property = "id",column = "id",id = true),
            @Result(
                    property = "consultants",
                    column = "tid",
                    one = @One(select = "findtid"))
    })
    List<Zixunyuyue> listAll(Integer uid);

    @Select("select * from consultants where id=#{tid}")
    Consultants findtid(Integer tid);


    @Select("select * from zixunyuyue where del=1 and uid=#{uid}")
    @Results({
            @Result(property = "id",column = "id",id = true),
            @Result(
                    property = "consultants",
                    column = "tid",
                    one = @One(select = "findtidwei"))
    })
    List<Zixunyuyue> listAllwei(Integer uid);

    @Select("select * from consultants where id=#{tid}")
    Consultants findtidwei(Integer tid);

}
